<?php
/**
 * @return
 * @author 朱乐斌
 * @date
 */

namespace app\api\validate;

use think\Validate;

class UserValidate extends Validate
{
    // 定义验证规则
    protected $rule = [
        'name' => 'require|max:10',
        'code' => 'require|max:6',
        'phone' => 'require|mobile',
        'image' => 'require',
        'password' => 'require|max:16',
        'password2' => 'require|max:16',
        'content' => 'max:50',
        'sex' => 'require',
        'type' => 'require',
    ];

    // 定义提示信息
    protected $message = [
        'name.require' => '用户名不能为空',
        'name.max' => '用户名不能超过10个字符',
        'code.require' => '验证码不能为空',
        'code.max' => '验证码不能超过6个字符',
        'phone.require' => '手机号不能为空',
        'phone.mobile' => '手机号格式错误',
        'image.require' => '头像不能为空',
        'password.require' => '密码不能为空',
        'password.max' => '密码不能超过16个字符',
        'password2.require' => '第二次密码不能为空',
        'content.max' => '不能超过50个字',
        'sex.require' => '性别不能为空',
        'type.require' => '类型不能为空',
    ];

    // 定义应用场景
    protected $scene = [
        'register' => ['phone', 'code', 'password','type'],
        'login' => ['phone', 'password'],
        'notesEdit' => ['name,phone'],
        'user' => ['name,sex,age,image,content'],
        'course' => ['name,phone'],
        'modifyPassword' => ['phone','password'],
        'sms' => ['phone']
    ];



}